'.$lang['Forums_return'].'';
include('./templates/'.$exbb['default_style'].'all_header.tpl');
include('./templates/'.$exbb['default_style'].'postok.tpl');
include('./templates/'.$exbb['default_style'].'footer.tpl');
} # end subdelete
function editform() {
global $exbb,$lang,$vars,$inuser;
$filetoopen = $exbb['home_path'].'data/allforums.php';
$forum = get_file($filetoopen);
$inforum = $vars['forum'];
$intopic = $vars['topic'];
$in_file = '';
list($id,$in_file,$in_page) = explode(':',$vars['id']);
$inmembmod = moderator($inforum,$forum);
if (($forum[$inforum]['private']) && (!$inuser['private'][$inforum])) {error($lang['Message_edit'],$lang['Editing_cant']);}
$forumname = stripslashes($forum[$inforum]['name']);
if ($forum[$inforum]['codes']) {
$codemap = '
';
$smilesmap = '
';
$java = '';
}
### Grab the post to edit
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd'.$in_file.'.php';
$allmessages = get_file($filetoopen);
if (!isset($allmessages[$id])) error($lang['Message_edit'],$lang['Dont_chg_url']);
if (!$inmembmod && $allmessages[$id]['p_id'] != $exbb['mem_id']) error($lang['Message_edit'],$lang['Editing_not_author']);
if (isset($allmessages[$id]['lockedit']) && !$inmembmod) error($lang['Message_edit'],$lang['Editing_blocked']);
if (isset($allmessages[$id]['ad_edited']) && isset($allmessages[$id]['lockedit']) && !defined('IS_ADMIN')) error($lang['Message_edit'],$lang['Editing_after_ad']);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/list.php';
$list = get_file($filetoopen);
$topictitle = $list[$intopic]['name'];
$is_poll = ($list[$intopic]['poll']) ? true : false;
if (!$inmembmod && $list[$intopic]['state'] == 'closed') error($lang['Message_edit'],$lang['Edit_closed']);
unset($list);
if ($vars['previewfirst'] == 'yes') {
if ( strlen($_POST['inpost']) > $exbb['max_posts']) {error($lang['Message_sending'],$lang['Big_post']);}
if ( strlen(trim($_POST['inpost'])) < 1) {error($lang['Message_sending'],$lang['Mess_needed']);}
$preview = str_replace( '$' , '$' , $vars['inpost'] );
$preview = ikoncode($preview);
if ($exbb['emoticons']) { $preview = setsmiles($preview); }
$preview = bads_filter($preview);
include('./templates/'.$exbb['default_style'].'preview.tpl');
unset($preview);
$vars['pollansw'] = $_POST['pollansw'];
$mo_edit = stripslashes($_POST['mo_edit']);
}
else {
if ($is_poll) {
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-poll.php';
$poll_data = get_file($filetoopen);
$vars['pollname'] = $poll_data['pollname'];
$poll_chces = unserialize( $poll_data['choices']);
$vars['pollansw'] = '';
foreach ($poll_chces as $choice) $vars['pollansw'] .= $choice[1]."\n";
unset($poll_chces,$poll_data,$filetoopen);
}
}
$upload = (isset($forum[$inforum]['upload']) && !empty($forum[$inforum]['upload']) && $exbb['file_upload']) ? $forum[$inforum]['upload'] : 0;
if ($upload && $inuser['upload']) {
$enctype = ' enctype="multipart/form-data"';
$hidden = '';
$filetoup = $lang['File_upload'].$upload.'
';
if (isset($allmessages[$id]['attach_id'])) {
$filetoup .= $lang['Keep_attach'].'( '.$allmessages[$id]['attach_file'].' )
';
$filetoup .= $lang['Del_attach'].'
';
$filetoup .= $lang['Replace_attach'].'
';
}
else {
$filetoup .= '';
}
}
if (!isset($vars['inpost'])) {
$rawpost = str_replace('',"\n\n",$allmessages[$id]['post']);
$rawpost = str_replace('
',"\n",$rawpost);
$rawpost = stripslashes($rawpost);
$mo_edit = stripslashes($allmessages[$id]['mo_text']);
} else { $rawpost = stripslashes($_POST['inpost']);}
$checked = ($allmessages[$id]['sig']) ? ' checked' : '';
$lockedit = ( isset($vars['lockedit']) ) ? ' checked' : '';
$sig_show = ''.$lang['Do_sig'].'
';
if ($exbb['emoticons']) {
$emoticonslink = ''.$lang['Smiles_on'].'';
$checked = ($allmessages[$id]['smiles']) ? ' checked' : '';
$emoticonsbutton = ''.$lang['Do_smiles'].'
';
}
$title_page = $exbb['boardname'].' :: '.$lang['Message_edit'];
include('./templates/'.$exbb['default_style'].'all_header.tpl');
include('./templates/'.$exbb['default_style'].'post_edit.tpl');
include('./templates/'.$exbb['default_style'].'footer.tpl');
} # end edit form
function processedit() {
global $exbb,$lang,$vars,$inuser,$inmembmod;
post_size();
$filetoopen = $exbb['home_path'].'data/allforums.php';
$forum = get_file($filetoopen);
$inforum = $vars['forum'];
$intopic = $vars['topic'];
$in_file = '';
list($id,$in_file,$in_page) = explode(':',$vars['id']);
$inmembmod = moderator($inforum,$forum);
if (($forum[$inforum]['private']) && (!$inuser['private'][$inforum])) { error($lang['Message_edit'],$lang['Editing_cant']); }
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd'.$in_file.'.php';
$allmessages = get_file($filetoopen);
$thd = fopen($filetoopen,'r+');
lock_file($thd);
if (!isset($allmessages[$id])) { fclose($thd); error($lang['Message_edit'],$lang['Dont_chg_url']); }
if (!$inmembmod && $allmessages[$id]['p_id'] != $exbb['mem_id']) { fclose($thd); error($lang['Message_edit'],$lang['Editing_not_author']); }
#unset($top_keys);
$edit_date = time();
if ($inmembmod && !defined('IS_ADMIN')) { #edition by moderator but not admin
if ($allmessages[$id]['p_id'] != $exbb['mem_id']) {
$allmessages[$id]['mo_editor'] = $exbb['member'];
if ($vars['mo_edit'] != '') $allmessages[$id]['mo_text'] = soft_clr_value($_POST['mo_edit']);
$allmessages[$id]['mo_edited'] = $edit_date;
if (isset($vars['lockedit'])) {$allmessages[$id]['lockedit'] = true;} else {unset($allmessages[$id]['lockedit']);}
}
}
elseif (defined('IS_ADMIN')) { #edition by admin
if ($allmessages[$id]['p_id'] != $exbb['mem_id']) {
$allmessages[$id]['ad_editor'] = $exbb['member'];
if ($vars['mo_edit'] != '') $allmessages[$id]['mo_text'] = soft_clr_value($_POST['mo_edit']);
$allmessages[$id]['ad_edited'] = $edit_date;
if (isset($vars['lockedit'])) {$allmessages[$id]['lockedit'] = true;} else {unset($allmessages[$id]['lockedit']);}
unset($allmessages[$id]['mo_editor'],$allmessages[$id]['mo_edited']);
}
}
else { #and user
$allmessages[$id]['edited'] = $edit_date;
}
if ($inmembmod && $allmessages[$id]['p_id'] == $exbb['mem_id']) $vars['inpost'] = soft_clr_value($_POST['inpost']);
$allmessages[$id]['post'] = preg_replace( "#(\?|&|;|&)PHPSESSID=([0-9a-zA-Z]){32}#i", "", $vars['inpost'] );
$allmessages[$id]['smiles'] = ($vars['inshowemoticons'] == 'yes') ? true : false;
$allmessages[$id]['sig'] = ($vars['inshowsignature'] == 'yes') ? true : false;
$upload = (isset($forum[$inforum]['upload']) && !empty($forum[$inforum]['upload']) && $exbb['file_upload']) ? $forum[$inforum]['upload'] : 0;
if (isset($vars['editattach'])) {
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/attaches-'.$intopic.'.php';
$t_attaches = get_file($filetoopen);
$attach_id = $allmessages[$id]['attach_id'];
$attach_name = $t_attaches[$attach_id]['id'];
if ($vars['editattach'] == 'del') {
unset($allmessages[$id]['attach_id'],$allmessages[$id]['attach_file']);
unset($t_attaches[$attach_id]);
save_file($filetoopen,$t_attaches);
$filetoopen = $exbb['home_path'].'uploads/'.$attach_name;
@unlink($filetoopen);
}
elseif ($vars['editattach'] == 'rep' && $upload) {
$exbb['uploadsize'] = $upload;
$attach = attach_upload($attach_id,$attach_name);
$allmessages[$id]['attach_file'] = $attach['attach_file'];
}
}
elseif ($upload && $inuser['upload']) {
$exbb['uploadsize'] = $upload;
$attach = attach_upload();
if (!empty($attach['attach_id']) && !empty($attach['attach_file'])) {
$allmessages[$id]['attach_id'] = $attach['attach_id'];
$allmessages[$id]['attach_file'] = $attach['attach_file'];
}
}
save_opened_file($thd,$allmessages);
unset($allmessages);
$relocurl = 'topic.php?forum='.$inforum.'&topic='.$intopic.'&start='.$in_page.'#'.$id;
$title_page = $exbb['boardname'].' :: '.$lang['Edit_complete'];
$ok_title = $lang['Edit_complete'];
$url1 = '
'.$lang['Forums_return'].'';
include('./templates/'.$exbb['default_style'].'all_header.tpl');
include('./templates/'.$exbb['default_style'].'postok.tpl');
include('./templates/'.$exbb['default_style'].'footer.tpl');
}
return;
}
function top_recount() { #start
global $exbb,$vars,$lang;
$inforum = $vars['forum'];
$intopic = $vars['topic'];
$postscount = 0;
$fileoopen = $exbb['home_path'].'forum'.$inforum.'/list.php';
include('./language/' . $exbb['default_lang'] . '/lang_admin.php');
if (file_exists($fileoopen)) {
$list = get_file($fileoopen);
$lst = @fopen($fileoopen,'r+');
lock_file($lst,2);
$topiccount = $list[$intopic]['posts'];
$extmode = ( isset($list[$intopic]['ext']) ) ? unserialize($list[$intopic]['ext']) : array();
$y = ( count($extmode) ) ? $list[$intopic]['fls'] : false;
$fileoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd.php';
$topic = get_file($fileoopen);
$postscount += count($topic);
if ($y) {
$extmode[0] = $postscount;
$fileoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd';
for ($i=1; $i<=$y; $i++) {
$topic = get_file($fileoopen.$i.'.php');
$extmode[$i] = count($topic);
$postscount += $extmode[$i];
}
$list[$intopic]['ext'] = serialize($extmode);
}
$postscount--;
$list[$intopic]['posts'] = $postscount;
save_opened_file($lst,$list);
unset($list,$topic);
$info = "$lang[Now_stat]
$lang[Posts_total] $topiccount$lang[After_recount]
$lang[Posts_total] $postscount";
error($lang['Counting_complete'],$info,'',0);
}
error($lang['Info'],$lang['Stat_error'],'',0);
}
function restore() {
global $exbb,$vars,$lang;
$inforum = $vars['forum'];
$intopic = $vars['topic'];
$filetoopen = $exbb['home_path'].'data/allforums.php';
$forum = get_file($filetoopen);
$forumname = $forum[$inforum]['name'];
unset($forum);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd.php';
$url = $exbb['boardurl'].'/topic.php?forum='.$inforum.'&topic='.$intopic;
if ( file_exists($filetoopen) ) {
$topic = get_file($filetoopen);
ksort($topic,SORT_NUMERIC);
reset($topic);
$t_date = key($topic);
$t_name = isset($topic[$t_date]['name']) ? $topic[$t_date]['name'] : '';
$t_desc = isset($topic[$t_date]['desc']) ? $topic[$t_date]['desc'] : '';
$t_author_id = $topic[$t_date]['p_id'] ? $topic[$t_date]['p_id'] : 0;
$t_author = getmember($t_author_id);
$t_author = ($t_author) ? $t_author['name'] : false;
$t_post = $topic[$t_date]['post'];
$posts = count($topic) - 1;
$time = date("d-m-Y H:i:s",$t_date-$exbb['usertime']*3600);
$files = 1;
$file = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd';
while ( file_exists($file.$files.'.php') ) $files++;
$files--;
$note = $lang['recover_btn'];
if ( $files > 0 ) $note .= $lang['recover_note'];
}
if (!isset($vars['check'])) {
unset($topic);
$title_page = $exbb['boardname'].' :: '.$lang['top_recover'];
$t_author = ($t_author) ? $t_author : $lang['Unreg'];
include('./templates/'.$exbb['default_style'].'all_header.tpl');
include('./templates/'.$exbb['default_style'].'logos.tpl');
include('./templates/'.$exbb['default_style'].'top_restore.tpl');
include('./templates/'.$exbb['default_style'].'footer.tpl');
}
else {
$topic[$t_date]['name'] = $vars['name'];
if (!empty($vars['desc'])) $topic[$t_date]['desc'] = $vars['desc'];
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd.php';
save_file($filetoopen,$topic);
end($topic);
$last_key = key($topic);
$last_id = isset($topic[$last_key]['p_id']) ? $topic[$last_key]['p_id'] : false;
unset($topic);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/list.php';
$list = get_file($filetoopen);
$lst = fopen($filetoopen,'r+');
lock_file($lst);
if ( $files > 0 ) {
$extmode = array();
$extmode[0] = $posts;
$list[$intopic]['fls'] = $files;
$list[$intopic]['ext'] = serialize($extmode);
$filetoopen = $exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-thd'.$files.'.php';
if ( file_exists($filetoopen) ) {
$topic = get_file($filetoopen);
ksort($topic,SORT_NUMERIC);
end($topic);
$last_key = key($topic);
$last_id = isset($topic[$last_key]['p_id']) ? $topic[$last_key]['p_id'] : 0;
}
}
$t_poster = getmember($last_id);
$t_poster = ($t_poster) ? $t_poster['name'] : false;
$list[$intopic]['name'] = $vars['name'];
if (!empty($vars['desc'])) $list[$intopic]['desc'] = $vars['desc'];
$list[$intopic]['state'] = 'open';
$list[$intopic]['posts'] = $posts;
$list[$intopic]['author'] = $t_author;
$list[$intopic]['a_id'] = $t_author_id;
$list[$intopic]['date'] = $t_date;
$list[$intopic]['poster'] = $t_poster;
$list[$intopic]['p_id'] = $last_id;
$list[$intopic]['postdate'] = $last_key;
if ( file_exists($exbb['home_path'].'forum'.$inforum.'/'.$intopic.'-poll.php') ) $list[$intopic]['poll'] = true;
#uasort ($list, 'sort_by_postdate');
save_opened_file($lst,$list);
@chmod($filetoopen,$exbb['ch_files']);
unset($list);
$relocurl = ( $files > 0 ) ? 'topic.php?forum='.$inforum.'&topic='.$intopic : 'forums.php?forum='.$inforum;
$title_page = $exbb['boardname'].' :: '.$lang['top_recover'];
$ok_title = $lang['top_recovered'];
$url1 = '